<script setup lang="ts">
import { useCommonStore } from '@/store'
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'
import { getSafeTopArea, getUniApiSyncRes } from '@/utils/native'

const commonStore = useCommonStore()

onLaunch(() => {
  // 保存客户端
  const [err, data] = getUniApiSyncRes('getSystemInfoSync')
  if (!err) {
    commonStore.setPlatform(data?.uniPlatform)
  }
  // 保存安全区域
  const safeTopData = getSafeTopArea()
  commonStore.setSafeTopArea(safeTopData)
})
onShow(() => {
  console.log('App Show=======>显示平台', commonStore.platform)
})
onHide(() => {
  console.log('App Hide=======>隐藏')
})
</script>
<style></style>
